j3deditor.bin.hierarchy
Class HierarchyManager

java.lang.Object
  extended by j3deditor.bin.hierarchy.HierarchyNode
      extended by j3deditor.bin.hierarchy.HierarchyManager

public class HierarchyManager
extends HierarchyNode

Contains and manages all scenes.

Author:
Risto Seene

Constructor Summary
HierarchyManager()
          Creates an instance of HierarchyManager.
 
Method Summary
 HierarchyNode addNewScene()
          Creates new blank J3DeScene object and attaches it to this hierarchy node.
 HierarchyNode addNewScene(java.lang.String filePath)
          Loads the J3DeScene from specified file and attaches it to this hierarchy node.
 void copyFromScenes()
          Forces all scenes to copy their selected objects.
 void cutFromScenes()
          Forces all scenes to cut their selected objects.
 void deleteFromScenes()
          Forces every scene to delete their selected objects.
 HierarchyNode getChild(int index)
          Returns the child at the specified index.
 int getIndexOfChild(HierarchyNode child)
          Returns the index of specified child.
 int getNumberOfChildren()
          Returns the number of children.
 HierarchyNode[] getSelectedObjects()
          Returns all selected scenes and objects from all scenes.
 boolean hasCopiedObjects()
          Tests if there are any objects copied from any scene.
protected  boolean hasNamedChild(HierarchyNode object)
          Tests if this node has child which name equals to the name of the given node.
 void pasteToScenes()
          Forces all scenes to paste their copied/cut objects to the selected scenes.
 void removeScene(HierarchyNode child)
          Removes the specified scene node.
 void removeScene(int index)
          Removes the scene at the specified index.
 void setSelectedObjects(HierarchyNode[] objects)
          Sets all selected nodes.
 
Methods inherited from class j3deditor.bin.hierarchy.HierarchyNode
clone, equals, getIndex, getParent, getParent, getType, removeChild, setName, setParent, toString, updateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HierarchyManager

public HierarchyManager()
Creates an instance of HierarchyManager.

Method Detail

addNewScene

public HierarchyNode addNewScene()
Creates new blank J3DeScene object and attaches it to this hierarchy node.

Returns:
the newly created scene which has been already added to this HierarchyManager

addNewScene

public HierarchyNode addNewScene(java.lang.String filePath)
                          throws java.lang.Exception
Loads the J3DeScene from specified file and attaches it to this hierarchy node.

Parameters:
filePath - the path of file where the scene will be loaded from
Returns:
the newly created scene which has been already added to this HierarchyManager
Throws:
java.lang.Exception - if loading the scene fails

removeScene

public void removeScene(int index)
Removes the scene at the specified index.

Parameters:
index - index of node which will be removed

removeScene

public void removeScene(HierarchyNode child)
Removes the specified scene node.

Parameters:
child - child node to be removed

getChild

public HierarchyNode getChild(int index)
Returns the child at the specified index.

Overrides:
getChild in class HierarchyNode
Parameters:
index - index of child
Returns:
Returns the child with the specified index

getNumberOfChildren

public int getNumberOfChildren()
Returns the number of children.

Overrides:
getNumberOfChildren in class HierarchyNode
Returns:
Returns the number of children as integer

getIndexOfChild

public int getIndexOfChild(HierarchyNode child)
Returns the index of specified child.

Overrides:
getIndexOfChild in class HierarchyNode
Parameters:
child - child node which index will be returned
Returns:
Returns the index of specified child

hasNamedChild

protected boolean hasNamedChild(HierarchyNode object)
Tests if this node has child which name equals to the name of the given node.

Overrides:
hasNamedChild in class HierarchyNode
Parameters:
object - node which name will be tested
Returns:
Returns true if the name of the given node equals to the name of this node, otherwise false

copyFromScenes

public void copyFromScenes()
Forces all scenes to copy their selected objects.


cutFromScenes

public void cutFromScenes()
Forces all scenes to cut their selected objects.


pasteToScenes

public void pasteToScenes()
Forces all scenes to paste their copied/cut objects to the selected scenes.


deleteFromScenes

public void deleteFromScenes()
Forces every scene to delete their selected objects.


setSelectedObjects

public void setSelectedObjects(HierarchyNode[] objects)
Sets all selected nodes.

Parameters:
objects - array of nodes to be set selected

getSelectedObjects

public HierarchyNode[] getSelectedObjects()
Returns all selected scenes and objects from all scenes.

Returns:
Returns array of all selected objects

hasCopiedObjects

public boolean hasCopiedObjects()
Tests if there are any objects copied from any scene.

Returns:
Returns true if any scene has copied objects, otherwise false